<?php
/**
 * 描述：会员管理中心-修改密码。
 * @final
 */
final class Exec_MC_Account_Password extends Exec_MC_Master
{   
    public function Get()
    {
        $this->MasterPage_Display(View::Fetch('mc/account/password.tpl'));
    }

    public function Post()
    {
        #获取数据
        $oldPassword=Functions::FormArgs('OldPassword');
        $newPassword=Functions::FormArgs('NewPassword');
        $confirmPassword=Functions::FormArgs('ConfirmPassword');


        #更新数据
        $account=new Account(Account::Session('Username'),Account::Session('Password'),TRUE);
        {
            if($account->Data['Password']!=Account::EncryptPassword($oldPassword,$account->Username))
            {
                echo 'PasswordWrong';
            }
            else
            {
                $account->Update(array
                (
                    'Password'=>$account->EncryptPassword($newPassword,$account->Username)
                ));
                $account->Login();
                echo 'Success';
            }
        }
        $account=NULL;
    }
}
?>